package top.lshaci.learning.jvm.gc;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;

/**
 * GCRootsTest
 *
 * @author lshaci
 * @date 2020/7/30 10:11
 * @since 1.0.0
 */
public class GCRootsTest {

    public static void main(String[] args) throws Exception {
        List<Object> numList = new ArrayList<>();
        Date birth = new Date();

        for (int i = 0; i < 100; i++) {
            numList.add(String.valueOf(i));
            TimeUnit.MILLISECONDS.sleep(10);
        }

        // heapdump-1596092377100

        System.err.println("数据添加完毕，请操作：");

        new Scanner(System.in).next();
        numList = null;
        birth = null;
        // heapdump-1596092455706

        System.err.println("numList, birth已置空，请操作：");
        new Scanner(System.in).next();

        System.err.println("结束");
    }
}
